package com.sg.business.commons.editingsupport;

import org.eclipse.jface.viewers.IStructuredSelection;

import com.sg.business.model.ManagermentCategory;
import com.sg.business.model.WFHumanTaskSetting;

public class SelectMCEditing extends NavigatorSelectorEditing {

	@Override
	protected String getNavigatorId() {
		return "management.select.category";
	}

	@Override
	protected Object getValueFromSelection(IStructuredSelection is) {
		if (is == null || is.isEmpty()) {
			return null;
		}
		ManagermentCategory managermentCategory = (ManagermentCategory) is
				.getFirstElement();
		boolean isSettingValue = managermentCategory.isSettingValue();
		if (!isSettingValue) {
			return null;
		}
		return managermentCategory.get_id();
	}

	@Override
	protected boolean canEdit(Object element) {
		if (element instanceof WFHumanTaskSetting) {
			return true;
		}
		return false;
	}
}
